package com.yzdmw.toutiao.detailsPage;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import java.util.ArrayList;
import java.util.List;

public class CommentViewModel extends ViewModel {

    private String mName = "yzdl";

    private MutableLiveData<List<CommentDetailBean>> commentsList = new MutableLiveData<List<CommentDetailBean>>(new ArrayList<>());

    public String getmName() {
        return mName;
    }

    public LiveData<List<CommentDetailBean>> getCommentsList() {
        return commentsList;
    }

    public void setmName(String mName) {
        this.mName = mName;
    }

    public void setCommentsList(List<CommentDetailBean> commentsList) {
        this.commentsList.setValue(commentsList);
    }

    public void init(){
        List<CommentViewModel.ReplyDetailBean> reply = new ArrayList<>();
        reply.add(new CommentViewModel.ReplyDetailBean("jhdl", "nb!!", null));
        reply.add(new CommentViewModel.ReplyDetailBean("jkdl", "66666", "jhdl"));
        commentsList.getValue().add(new CommentViewModel.CommentDetailBean("yzdl", 13, "我操统绝对很低分。", reply));
        commentsList.getValue().add(new CommentViewModel.CommentDetailBean("sydl", 2, "我爱打码。", null));
    }

    public static class CommentDetailBean {
        private String nickName;
        private int likeNum;
        private String content;
        private List<ReplyDetailBean> replyList;
        private Boolean isLike = false;

        public CommentDetailBean(String nickName, int likeNum, String content, List<ReplyDetailBean> replyList) {
            this.nickName = nickName;
            this.likeNum = likeNum;
            this.content = content;
            this.replyList = replyList;
        }

        public String getNickName() {
            return nickName;
        }

        public int getLikeNum() {
            return likeNum;
        }

        public String getContent() {
            return content;
        }

        public List<ReplyDetailBean> getReplyList() {
            return replyList;
        }

        public Boolean getLike() {
            return isLike;
        }

        public void setNickName(String nickName) {
            this.nickName = nickName;
        }

        public void setLikeNum(int likeNum) {
            this.likeNum = likeNum;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public void setReplyList(List<ReplyDetailBean> replyList) {
            this.replyList = replyList;
        }

        public void setLike(Boolean like) {
            isLike = like;
        }
    }
    public static class ReplyDetailBean {
        private String nickName;
        private String content;
        private String to = null;

        public ReplyDetailBean(String nickName, String content, String to) {
            this.nickName = nickName;
            this.content = content;
            this.to = to;
        }

        public String getNickName() {
            return nickName;
        }

        public String getContent() {
            return content;
        }

        public String getTo() {
            return to;
        }

        public void setNickName(String nickName) {
            this.nickName = nickName;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public void setTo(String to) {
            this.to = to;
        }
    }
}